<template>
	<view>
		<view class="form_split_10"></view>
		<view class="box_1">
			<view class="up_box">
				<u-upload ref="uUpload" class="upload_con" :action="action" max-count="1" :multiple="false"
					:custom-btn="true" :show-progress="false" :show-upload-list="false"
					:header="{ 'Content-Type': 'multipart/form-data', 'user-token': userToken, platform: platform }"
					:max-size="1024 * 1024 * fileupload_size" :limitType="['png', 'jpg', 'jpeg', 'bmp', 'gif']"
					@on-uploaded="afterRead" @on-choose-complete="onChooseComplete" @on-error="handleUploadError"
					@on-oversize="handleOversize">
					<view slot="addBtn">
						<image v-if="logo_src" :src="logo_src" class="logo"></image>
						<view class="txt_box">点击上传</view>
					</view>
				</u-upload>
			</view>
		</view>
		<view class="form_split_10"></view>
		<u-form>
			<!-- 企业名称-->
			<u-field :field-style="companynameDisabled ? fstyle : ''"
				placeholder-style="color:#757575;font-size:14px !important;" :disabled="companynameDisabled"
				v-model="basic.companyname" required label="企业名称" placeholder="请填写" class="reset_after" />
			<!-- 企业简称 -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;"
				v-if="field_rule.basic.short_name.is_display == 1" v-model="basic.short_name"
				:required="field_rule.basic.short_name.is_require == 1 ? true : false"
				:label="field_rule.basic.short_name.field_cn" placeholder="请填写"
				:rules="field_rule.basic.short_name.is_require == 1 ? [{ required: true, message: '请填写' + field_rule.basic.short_name.field_cn }] : []"
				class="reset_after" :clearable="false" />
			<!-- 企业性质 -->
			<view class="form-line u-border-bottom" @click="showPickerNature = true">
				<view class="form-field">
					<view class="label">企业性质</view>
					<view :class="nature_text ? 'text' : 'text ac'">{{ nature_text ? nature_text : '请选择' }}</view>
				</view>
				<u-icon class="arrow-icon" name="arrow-right"></u-icon>
			</view>

			<!-- 企业规模 -->
			<view class="form-line u-border-bottom" @click="showPickerScale = true">
				<view class="form-field">
					<view class="label no">企业规模</view>
					<view :class="scale_text ? 'text' : 'text ac'">{{ scale_text ? scale_text : '请选择' }}</view>
				</view>
				<u-icon class="arrow-icon" name="arrow-right"></u-icon>
			</view>

			<!-- 所属行业 -->
			<view class="form-line u-border-bottom" @click="showPickerTrade = true">
				<view class="form-field">
					<view class="label">所属行业</view>
					<view :class="trade_text ? 'text' : 'text ac'">{{ trade_text ? trade_text : '请选择' }}</view>
				</view>
				<u-icon class="arrow-icon" name="arrow-right"></u-icon>
			</view>

			<!-- 注册资金 -->
			<!-- <view style="padding: 0;" class=" form-line u-border-bottom"> -->
			<u-field class="form-field" placeholder-style="color:#757575;font-size:16px !important;"
				v-if="field_rule.basic.registered.is_display == 1" v-model="basic.registered"
				:required="field_rule.basic.registered.is_require == 1 ? true : false"
				:label="field_rule.basic.registered.field_cn" placeholder="请填写" :clearable="false"></u-field>
			<!-- <u-icon class="arrow-icon" style="padding: 0 22rpx;" name="arrow-right"></u-icon> -->
			<!-- </view> -->

			<view class="for_btn" @click="showCurrencyPicker = true">
				<view class="right_handle">{{ currency_text }}</view>
				<u-icon class="arrow-icon" style="padding: 0 22rpx; position: absolute; top: -68rpx; right: 8rpx;"
					name="arrow-right"></u-icon>
			</view>
			<!-- 企业网址 -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;"
				v-if="field_rule.info.website.is_display == 1" v-model="info.website"
				:required="field_rule.info.website.is_require == 1 ? true : false"
				:label="field_rule.info.website.field_cn" placeholder="请填写" class="reset_after" :clearable="false" />
			<!-- 企业福利 -->
			<view v-if="field_rule.basic.tag.is_display == 1" class="form-line u-border-bottom" @click="handlerShowTag">
				<view class="form-field">
					<view class="label" :class="field_rule.basic.tag.is_require == 1 ? '' : 'no'">
						{{ field_rule.basic.tag.field_cn }}
					</view>
					<view :class="tag_text ? 'text' : 'text ac'">{{ tag_text ? tag_text : '请选择' }}</view>
				</view>
				<u-icon class="arrow-icon" name="arrow-right"></u-icon>
			</view>
			<!-- 所在地区 -->
			<view class="form-line u-border-bottom" @click="showPickerDistrict = !showPickerDistrict">
				<view class="form-field">
					<view class="label">所在地区</view>
					<view :class="district_text ? 'text' : 'text ac'">{{ district_text ? district_text : '请选择' }}</view>
				</view>
				<u-icon class="arrow-icon" name="arrow-right"></u-icon>
			</view>

			<view class="box_3">
				<input placeholder-style="color:#757575;font-size:14px !important;" type="text" class="text"
					v-model="info.address" placeholder="详细地址" />
				<!-- <view class="tag" @click="handlerShowMap">标注</view> -->
			</view>
			<!-- 企业简介 -->
			<u-field v-if="field_rule.info.short_desc.is_display == 1" disabled
				:label="field_rule.info.short_desc.field_cn"
				:required="field_rule.info.short_desc.is_require == 1 ? true : false" class="reset_after no_border" />
			<view class="box_4" v-if="field_rule.info.short_desc.is_display == 1">
				<view v-if="isShortDescTextarea" @click="handleShortTextarea"
					:class="isShortDescTextarea && info.short_desc == '' ? 'textarea textarea-color' : 'textarea'">
					{{ info.short_desc ? info.short_desc : '请输入' }}
				</view>
				<textarea maxlength="-1" class="textarea2" v-if="!isShortDescTextarea" :focus="isShortDescFocus"
					@blur="handleShortTextarea" @input="handleInput" :value="info.short_desc"
					placeholder="请输入"></textarea>
			</view>
			<!-- 企业介绍 -->
			<u-field v-if="field_rule.info.content.is_display == 1" disabled :label="field_rule.info.content.field_cn"
				:required="field_rule.info.content.is_require == 1 ? true : false" class="reset_after no_border" />
			<view class="box_4" v-if="field_rule.info.content.is_display == 1">
				<view v-if="isContentTextarea" @click="handleContentTextarea"
					:class="isContentTextarea && info.content == '' ? 'textarea textarea-color' : 'textarea'">
					{{ info.content ? info.content : '请输入' }}
				</view>
				<textarea maxlength="-1" class="textarea2" v-if="!isContentTextarea" :value="info.content"
					:focus="isContentFocus" @blur="handleContentTextarea" @input="handleInput2"
					placeholder="请输入"></textarea>
			</view>

			<view class="form_split_10"></view>
			<!-- 联系人 -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;" v-model="contact.contact" required
				name="contact" label="联系人" placeholder="请填写" class="reset_after" :clearable="false" />
			<!-- 联系电话 -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;" v-model="contact.mobile" required
				name="mobile" type="number" label="联系电话" placeholder="请填写" class="reset_after" @input="hanlderMobile"
				:clearable="false" />
			<!-- 联系微信 -->
			<!-- <u-field 
				v-if="field_rule.contact.weixin.is_display == 1" 
				name="weixin" 
				:required="field_rule.contact.weixin.is_require == 1 ? true : false"
				v-model="contact.weixin"
				:label="field_rule.contact.weixin.field_cn" 
				placeholder="请填写" 
				class="reset_after"
				@input="hanlderWeixin"
				:clearable="false">
				<u-checkbox 
					slot="right" 
					shape="circle"
					v-model="weixin_sync_mobile" 
					icon-size="32rpx" 
					@change="handlerSync">
					同手机号
				</u-checkbox>
			</u-field> -->
			<!-- 联系固话 -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;"
				v-if="field_rule.contact.telephone.is_display == 1"
				:required="field_rule.contact.telephone.is_require == 1 ? true : false" v-model="contact.telephone"
				name="telephone" type="text" :label="field_rule.contact.telephone.field_cn" placeholder="请填写"
				class="reset_after" :clearable="false" />
			<!-- 联系邮箱 -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;"
				v-if="field_rule.contact.email.is_display == 1"
				:required="field_rule.contact.email.is_require == 1 ? true : false" v-model="contact.email" name="email"
				:label="field_rule.contact.email.field_cn" placeholder="请填写" class="reset_after" :clearable="false" />
			<!-- 联系qq -->
			<u-field placeholder-style="color:#757575;font-size:16px !important;"
				v-if="field_rule.contact.qq.is_display == 1"
				:required="field_rule.contact.qq.is_require == 1 ? true : false" v-model="contact.qq" name="qq"
				:label="field_rule.contact.qq.field_cn" placeholder="请填写" class="reset_after" :clearable="false" />
			<view style="margin: 32rpx;">
				<u-button shape="circle" type="primary" @click="onSubmit">保存资料</u-button>
			</view>
		</u-form>

		<u-popup v-model="showPickerDistrict" mode="bottom" ref="dropDistrict" height="900rpx"
			:custom-style="{ overflow: 'hidden' }">
			<DistrictFilter :districts="[basic.district1, basic.district2, basic.district3]" :type="false"
				@doSelect="doSelectDistrict" :all="false"></DistrictFilter>
		</u-popup>
		<u-select v-model="showPickerTrade" :list="columnsTrade" :default-value="[tradeDefaultIndex]"
			@confirm="onConfirmTrade" @cancel="showPickerTrade = false" />
		<u-select v-model="showPickerNature" :list="columnsNature" :default-value="[natureDefaultIndex]"
			@confirm="onConfirmNature" @cancel="showPickerNature = false"></u-select>
		<u-select v-model="showPickerScale" :list="columnsScale" @confirm="onConfirmScale"
			:default-value="[scaleDefaultIndex]" @cancel="showPickerScale = false" />
		<u-picker v-model="showCurrencyPicker" mode="selector" :range="options_currency" range-key="text"
			@confirm="onConfirmCurrency" @cancel="showCurrencyPicker = false" />
		<view :class="showTag ? 'addInvitation ac' : 'addInvitation'">
			<CompanyTag ref="companyTag" title="企业福利" :tag_arr="basic.tag" @handlerCloseTag="handlerCloseTag">
			</CompanyTag>
		</view>
		<u-mask :show="uploading">
			<view class="uploading_wrapper">
				<view class="upload_con">
					<u-loading mode="flower" size="60rpx"></u-loading>
					<view class="upload_text">正在上传</view>
				</view>
			</view>
		</u-mask>
		<u-top-tips ref="uTips"></u-top-tips>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import CompanyTag from './components/CompanyTag';
	import http from '@/utils/http';
	import api from '@/api';
	import DistrictFilter from '@/components/DistrictFilter';
	import {
		getParam
	} from '@/utils/index'
	import {
		mapState
	} from 'vuex';
	export default {
		name: 'BasicInfo',
		components: {
			CompanyTag,
			DistrictFilter
		},
		data() {
			return {
				infoContent: '',
				infoShort_desc: '',
				fstyle: {
					color: '#969799'
				},
				isShortDescFocus: false,
				isContentFocus: false,
				action: getApp().globalData.baseURL + api.uploadFile,
				uploading: false,
				companynameDisabled: true,
				currency_text: '万人民币',
				options_currency: [{
						text: '万人民币',
						value: 0
					},
					{
						text: '万美元',
						value: 1
					}
				],
				showCurrencyPicker: false,
				natureDefaultIndex: 0,
				tradeDefaultIndex: 0,
				scaleDefaultIndex: 0,
				showTag: false,
				showPickerNature: false,
				showPickerTrade: false,
				showPickerScale: false,
				field_rule: {
					basic: {
						logo: {},
						short_name: {},
						registered: {},
						tag: {}
					},
					contact: {
						weixin: {},
						telephone: {},
						qq: {},
						email: {}
					},
					info: {
						website: {},
						short_desc: {},
						content: {}
					}
				},
				basic: {
					logo: 0,
					companyname: '',
					short_name: '',
					registered: 0,
					currency: 0,
					nature: 1,
					trade: 1,
					scale: 0,
					district1: 1,
					district2: 2,
					district3: 3,
					map_lat: 0,
					map_lng: 0,
					map_zoom: 0,
					tag: []
				},
				info: {
					content: '',
					short_desc: '',
					website: '',
					address: ''
				},
				contact: {
					contact: '',
					mobile: '',
					weixin: '',
					telephone: '',
					email: '',
					qq: ''
				},
				logo_src: '',
				nature_text: '',
				trade_text: '',
				scale_text: '',
				district_text: '',
				tag_text: '',
				weixin_sync_mobile: false,
				showPickerDistrict: false,
				isReg: '',
				isContentTextarea: true,
				isShortDescTextarea: true
			};
		},
		created() {
			this.fetchData();
		},
		mounted() {
			this.$store.dispatch('getClassify', 'companyNature');
			this.$store.dispatch('getClassify', 'trade');
			this.$store.dispatch('getClassify', 'companyScale');
			this.$store.dispatch('getClassify', 'citycategory');
			this.isReg = getParam().isReg ? getParam().isReg : '';
		},
		computed: {
			...mapState({
				userToken: state => state.userToken,
				platform: state => state.platform,
				fileupload_size: state => state.config.fileupload_size / 1024
			}),
			columnsNature() {
				let CompanyNature = this.$store.state.classifyCompanyNature;
				let arr = [];
				if (CompanyNature == '') return;
				CompanyNature.forEach(item => {
					arr.push({
						value: item.id,
						label: item.text
					});
				});
				return arr;
			},
			columnsTrade() {
				let columnsTrade = this.$store.state.classifyTrade;
				let arr = [];
				if (columnsTrade == '') return;
				columnsTrade.forEach(item => {
					arr.push({
						value: item.id,
						label: item.text
					});
				});
				return arr;
			},
			columnsScale() {
				let CompanyScale = this.$store.state.classifyCompanyScale;
				let arr = [];
				if (CompanyScale == '') return;
				CompanyScale.forEach(item => {
					arr.push({
						value: item.id,
						label: item.text
					});
				});
				return arr;
			},
			areaDistrict() {
				return this.$store.state.classifyCityCategory;
			}
		},
		methods: {
			handleInput(e) {
				this.infoShort_desc = e.detail.value;
			},
			handleInput2(e) {
				this.infoContent = e.detail.value;
			},
			handleContentTextarea() {
				if (this.infoContent != '') {
					this.info.content = this.infoContent;
				}
				this.isContentFocus = !this.isContentFocus;
				this.isContentTextarea = !this.isContentTextarea;
			},
			handleShortTextarea() {
				if (this.infoShort_desc != '') {
					this.info.short_desc = this.infoShort_desc;
				}
				this.isShortDescFocus = !this.isShortDescFocus;
				this.isShortDescTextarea = !this.isShortDescTextarea;
			},
			validatorTel(val) {
				return /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/.test(val);
			},
			/**
			 * 注册资金
			 * @index 当前选中下标（Number）
			 * */
			onConfirmCurrency(index) {
				this.currency_text = this.options_currency[index].text;
				this.basic.currency = this.options_currency[index].value;
				this.showCurrencyPicker = false;
			},
			/**
			 * 所在地区
			 * 	@data (Array) 当前所选地区id及名称
			 * */
			doSelectDistrict(data) {
				this.basic.district1 = data[0];
				this.basic.district2 = data[1];
				this.basic.district3 = data[2];
				this.district_text = data[3];
				this.showPickerDistrict = !this.showPickerDistrict;
			},
			/**
			 * 联系电话
			 * @val (String) 联系电话input 输入内容
			 * */
			hanlderMobile(val) {
				if (this.weixin_sync_mobile === true) {
					this.contact.weixin = val;
				}
			},
			/**
			 *
			 * */

			hanlderWeixin() {
				if (this.contact.weixin !== this.contact.mobile) {
					this.weixin_sync_mobile = false;
				} else {
					this.weixin_sync_mobile = true;
				}
			},
			/**
			 * 同手机号
			 * */
			handlerSync() {
				if (!this.weixin_sync_mobile) {
					this.contact.weixin = this.contact.mobile;
				}
			},
			/**
			 * 初始化获取数据
			 * */
			fetchData() {
				http.get(api.company_profile, {})
					.then(res => {
						const {
							basic,
							contact,
							info,
							field_rule
						} = {
							...res.data.data
						};
						if (basic.companyname === undefined || basic.companyname == '') {
							this.companynameDisabled = false;
						}
						this.basic = {
							logo: basic.logo,
							companyname: basic.companyname,
							short_name: basic.short_name,
							registered: basic.registered,
							currency: basic.currency,
							nature: basic.nature,
							trade: basic.trade,
							scale: basic.scale,
							district1: basic.district1,
							district2: basic.district2,
							district3: basic.district3,
							map_lat: basic.map_lat,
							map_lng: basic.map_lng,
							map_zoom: basic.map_zoom,
							tag: basic.tag
						};
						this.info = {
							content: info.content,
							short_desc: info.short_desc,
							website: info.website,
							address: info.address
						};
						this.infoShort_desc = info.short_desc;
						this.infoContent = info.content;
						this.contact = {
							contact: contact.contact,
							mobile: contact.mobile,
							weixin: contact.weixin,
							telephone: contact.telephone,
							email: contact.email,
							qq: contact.qq
						};
						if (this.contact.mobile !== '' && this.contact.mobile === this.contact.weixin) {
							this.weixin_sync_mobile = true;
						}
						this.field_rule = field_rule;
						this.tag_text = basic.tag_text;
						this.logo_src = basic.logo_src;
						this.nature_text = basic.nature_text;
						this.trade_text = basic.trade_text;
						this.scale_text = basic.scale_text;
						this.district_text = basic.district_text;
						this.natureDefaultIndex = this.columnsNature.findIndex(item => {
							return parseInt(item.value) === parseInt(this.basic.nature);
						});
						this.tradeDefaultIndex = this.columnsTrade.findIndex(item => {
							return parseInt(item.value) === parseInt(this.basic.trade);
						});
						this.scaleDefaultIndex = this.columnsScale.findIndex(item => {
							return parseInt(item.value) === parseInt(this.basic.scale);
						});
					})
					.catch(() => {});
			},
			// 选择所在地区
			onConfirmDistrict(value) {
				this.basic.district1 = value[0].code;
				this.basic.district2 = value[1].code;
				this.basic.district3 = value[2].code;
				this.district_text = `${value[0].name}/${value[1].name}/${value[2].name}`;
				this.showPickerDistrict = !this.showPickerDistrict;
			},
			/**
			 * 选择企业性质
			 * @value (Array) 当前所选企业性质
			 * */

			onConfirmNature(value) {
				this.basic.nature = value[0].value ? value[0].value : this.columnsNature[0].value;
				this.nature_text = value[0].label ? value[0].label : this.columnsNature[0].label;
				this.showPickerNature = !this.showPickerNature;
			},
			/**
			 * 选择企业行业
			 * @value (Array) 当前所选企业行业
			 * */

			onConfirmTrade(value) {
				this.basic.trade = value[0].value ? value[0].value : this.columnsTrade[0].value;
				this.trade_text = value[0].label ? value[0].label : this.columnsTrade[0].label;
				this.showPickerTrade = !this.showPickerTrade;
			},
			/**
			 * 选择企业规模
			 * @value (Array) 当前所选企业规模
			 * */

			onConfirmScale(value) {
				this.basic.scale = value[0].value ? value[0].value : this.columnsScale[0].value;
				this.scale_text = value[0].label ? value[0].label : this.columnsScale[0].label;
				this.showPickerScale = !this.showPickerScale;
			},
			/**
			 * logo 上传
			 * @lists (Array) 图片集合
			 * */
			afterRead(lists) {
				if (lists.length > 0 && lists[0].error == false) {
					this.uploading = false;
					let res = lists[lists.length - 1];
					this.basic.logo = res.response.data.file_id;
					this.logo_src = res.response.data.file_url;
					this.$refs.uUpload.clear();
				}
			},
			/**
			 * logo 上传
			 * @lists (Array) 选中图片数量
			 * */

			onChooseComplete(lists) {
				if (lists.length > 0) {
					this.uploading = true;
				}
			},
			/**
			 * logo 上传失败回调函数
			 * */
			handleUploadError(error) {
				this.uploading = false;
			},
			/**
			 * 图片大小超出最大限制
			 * */
			handleOversize() {
				uni.showToast({
					title: '图片最大不能超过' + this.fileupload_size + 'M',
					icon: 'none'
				});
			},
			/**
			 * 保存修改
			 * */
			onSubmit() {
				this.info.short_desc = this.infoShort_desc;
				this.info.content = this.infoContent;
				if (this.field_rule.basic.logo.is_display === 1 && this.field_rule.basic.logo.is_require === 1 && this
					.basic.logo === 0) {
					this.$refs.uTips.show({
						title: '请上传' + this.field_rule.basic.logo.field_cn,
						type: 'error'
					});
					return false;
				}
				// 企业名称
				if (this.basic.companyname == '') {
					this.$refs.uToast.show({
						title: '请填写企业名称',
						type: 'default'
					});
					return false;
				}
				// 企业简称
				if (this.field_rule.basic.short_name.is_require == 1) {
					if (this.basic.short_name == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.basic.short_name.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 企业性质
				if (this.nature_text == '') {
					this.$refs.uToast.show({
						title: '请选择企业性质',
						type: 'default'
					});
					return false;
				}
				// 企业规模
				// if(this.scale_text == ''){
				// 	this.$refs.uToast.show({
				// 		title: '请选择企业规模',
				// 		type: 'default'
				// 	})
				// 	return false
				// }
				// 所属行业
				if (this.trade_text == '') {
					this.$refs.uToast.show({
						title: '请选择所属行业',
						type: 'default'
					});
					return false;
				}
				// 注册资金
				if (this.field_rule.basic.registered.is_require == 1) {
					if (this.basic.registered == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.basic.registered.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 企业网址
				if (this.field_rule.info.website.is_require == 1) {
					if (this.info.website == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.info.website.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 企业福利
				if (this.field_rule.basic.tag.is_require == 1) {
					if (this.tag_text == '') {
						this.$refs.uToast.show({
							title: '请选择' + this.field_rule.basic.tag.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 所在地区
				if (this.district_text == '') {
					this.$refs.uToast.show({
						title: '请选择所在地区',
						type: 'default'
					});
					return false;
				}
				// 企业简介
				if (this.field_rule.info.short_desc.is_require == 1) {
					if (this.info.short_desc == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.info.short_desc.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 企业介绍
				if (this.field_rule.info.content.is_require == 1) {
					if (this.info.content == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.info.content.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 联系人
				if (this.contact.contact == '') {
					this.$refs.uToast.show({
						title: '请填写联系人',
						type: 'default'
					});
					return false;
				}
				//联系电话
				if (this.contact.mobile == '') {
					this.$refs.uToast.show({
						title: '请填写联系电话',
						type: 'default'
					});
					return false;
				}
				this.contact.weixin = this.contact.mobile;
				// 联系微信
				// if(this.field_rule.contact.weixin.is_require == 1){
				// 	if(this.contact.weixin == ''){
				// 		this.$refs.uToast.show({
				// 			title: '请填写' + this.field_rule.contact.weixin.field_cn,
				// 			type: 'default'
				// 		})
				// 		return false
				// 	}
				// }
				// 联系固话
				if (this.field_rule.contact.telephone.is_require == 1) {
					if (!this.validatorTel(this.contact.telephone)) {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.contact.telephone.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 联系邮箱
				if (this.field_rule.contact.email.is_require == 1) {
					if (this.contact.email == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.contact.email.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				// 联系qq
				if (this.field_rule.contact.qq.is_require == 1) {
					if (this.contact.qq == '') {
						this.$refs.uToast.show({
							title: '请填写' + this.field_rule.contact.qq.field_cn,
							type: 'default'
						});
						return false;
					}
				}
				http.post(api.company_profile, {
						basic: this.basic,
						info: this.info,
						contact: this.contact
					})
					.then(res => {
						if (res.data.code == 200) {
							uni.setStorageSync('toCompleteCompanyInfo', false)
							this.$refs.uTips.show({
								title: res.data.message,
								type: 'success'
							});
							setTimeout(() => {
								this.isReg ? uni.redirectTo({
									url: '/company/CompanyIndex'
								}) : uni.navigateBack({
									delta: 1
								});
							}, 1500);
						}
					})
					.catch(() => {});
			},
			/**
			 * 企业福利弹窗开启
			 * */
			handlerShowTag() {
				this.showTag = true;
			},
			/**
			 * 企业福利弹窗关闭
			 * @tagInfo (Object) 当前所选福利标签 tagIdArr(当前所选标签id 数组) tagTextArr (挡墙所选标签文字 数组)
			 * */
			handlerCloseTag(tagInfo) {
				this.showTag = false;
				if (tagInfo === undefined) {
					return false;
				}
				this.basic.tag = tagInfo.tagIdArr;
				this.tag_text = tagInfo.tagTextArr.length > 0 ? tagInfo.tagTextArr.join(',') : '';
			},
			/**
			 * 地图标注
			 * */
			handlerShowMap() {
				var _this = this;
				if (_this.basic.map_lat > 0 && _this.basic.map_lng > 0) {
					openMap(_this.basic.map_lat, _this.basic.map_lng);
				} else {
					uni.getLocation({
						type: 'gcj02',
						success: function(res) {
							openMap(res.latitude, res.longitude);
						},
						fail: function(error) {
							uni.showModal({
								content: '检测到您没打开获取位置功能权限，是否去设置打开？',
								confirmText: '确认',
								cancelText: '取消',
								success() {
									uni.openSetting({
										success(res) {},
										fail(err) {}
									});
								}
							});
						}
					});
				}

				function openMap(map_lat, map_lng) {
					uni.chooseLocation({
						latitude: map_lat,
						longitude: map_lng,
						success: function(res) {
							console.log(res);
							_this.basic.map_lat = res.latitude;
							_this.basic.map_lng = res.longitude;
							_this.info.address = res.address;
						}
					});
				}
			}
		}
	};
</script>

<style lang="scss" scoped>
	.u-popup {
		top: 80%;
		right: 0;
		-webkit-transform: translate3d(0, -80%, 0);
		transform: translate3d(0, -80%, 0);
	}

	.right_handle {
		right: 46rpx;
		line-height: 100rpx;
	}

	.uploading_wrapper {
		display: flex;
		width: 100%;
		height: 100%;
		align-items: center;
		justify-content: center;

		.upload_con {
			text-align: center;

			.upload_text {
				color: #fff;
			}
		}
	}

	.box_4 {
		width: 100%;
		background-color: #ffffff;
		// position: relative;
		padding: 0 0rpx 40rpx 0rpx;
	}

	.box_3 {
		.tag {
			position: absolute;
			right: 34rpx;
			top: 12rpx;
			padding: 24rpx 36rpx 24rpx 0;
			font-size: 28rpx;
			color: #666666;
			background-image: url(static/img/location_ico_blue.png);
			background-repeat: no-repeat;
			background-position: right center;
			background-size: 28rpx;
			z-index: 999;
		}

		.text {
			&::placeholder {
				color: #c9c9c9;
			}

			font-size: 28rpx;
			border: 0;
			width: 360rpx;
			height: 80rpx;
			position: absolute;
			left: 238rpx;
			top: 10rpx;
			color: #333333;
		}

		&::after {
			position: absolute;
			left: 0;
			box-sizing: border-box;
			content: ' ';
			pointer-events: none;
			right: 0;
			bottom: 0;
			transform: scaleY(0.5);
			border-bottom: 2rpx solid #ebebeb;
		}

		width: 100%;
		height: 100rpx;
		background-color: #ffffff;
		position: relative;
		padding: 0 136rpx 0 238rpx;
	}

	.sync_phone {
		position: absolute;
		right: 24rpx;
		top: -50px;
		font-size: 24rpx;
		color: #515151;
		padding: 30rpx 0;
		line-height: 48rpx;
	}

	.box_1 {
		.u-uploader__upload {
			margin: 0;
		}

		.txt_box {
			padding: 20rpx 0 0rpx;
			font-size: 30rpx;
			color: #a7a7a7;
		}

		.up_box {
			width: 150rpx;
			height: 300rpx;
			position: relative;
			padding-top: 50rpx;
			margin: 0 auto;

			.upload_con {
				width: 100%;
				height: 100%;
			}

			.logo {
				width: 150rpx;
				height: 150rpx;
				border: 0;
				border-radius: 100%;
			}
		}

		width: 100%;
		height: 300rpx;
		background-color: #ffffff;
		text-align: center;
	}

	.split_bar {
		width: 100%;
		height: 18rpx;
	}

	.u-overlay {
		text-align: center;
		z-index: 2;
	}

	.u-loading {
		top: 36%;
	}

	.u-loading__text {
		color: #c3c3c3;
	}

	.addInvitation {
		width: 100vw;
		height: 100vh;
		position: fixed;
		left: 0;
		top: 0;
		right: 0;
		transform: translateX(100%);
		z-index: 10052;
		background-color: #fff;
		transition: all 0.5s;

		&.ac {
			transform: translateX(0%);
		}
	}
</style>